import { getLastVersionRequest} from '@/api/version'

const user = {
	namespaced: true,
	state: {
		info: null
	},

	getters: {},

	mutations: {
		SET_INFO: (state, info) => {
			state.info = info
		}
	},

	actions: {
		getLastVersionAction({ commit }, parameters) {
			return new Promise((resolve, reject) => {
				getLastVersionRequest(parameters)
					.then(response => {
						const info = response.result
						commit('SET_INFO', info)
						resolve(response)
					})
					.catch(error => {
						reject(error)
					})
			})
		}
	}
}

export default user
